# -*- coding: utf-8 -*-
from odoo import api, fields, models
import datetime
from operator import itemgetter
from odoo.exceptions import AccessError, UserError, ValidationError


class InheritResPartner(models.Model):
    _inherit = 'res.partner'


    id_card = fields.Char(string='身分證字號')
    line_id = fields.Char(string='LINE ID')
    fb_id = fields.Char(string='FB 名稱')
    emergency_contact = fields.Char(string='緊急聯絡人')
    emergency_relation = fields.Char(string='關係')
    emergency_mobile = fields.Char(string='緊急聯絡人電話')
    country_id = fields.Many2one(comodel_name='res.country', default=229)
    tax_id_number = fields.Char(string='統一編號')
    supply_product = fields.One2many(comodel_name='product.supplierinfo', inverse_name='name')



    @api.model
    def name_search(self, name='', args=None, operator='ilike', limit=100):
        args = args or []
        domain = []
        if name:
            domain = ['|', ('name', operator, name), '|', ('mobile', operator, name), ('ref',operator, name)]

        banks = self.search(domain + args, limit=limit)
        return banks.name_get()


